#ifndef _CFG_H_
#define _CFG_H_

#ifdef __cplusplus
extern "C"{
#endif

typedef struct CFGITEM {
	unsigned int hash;
	char * key;
	char * value;
} CFGITEM;

typedef struct CFGMAP {
	unsigned int cap;
	unsigned int size;
	CFGITEM * array;
} CFGMAP;

CFGMAP * cfg_new();
int cfg_load(CFGMAP * p, const char * path);
int cfg_dump(CFGMAP * p);
int cfg_free(CFGMAP * p);
const char * cfg_get_str(CFGMAP * p, const char * key, const char * def);
int cfg_get_int(CFGMAP * p, const char * key, int def);
double cfg_get_double(CFGMAP * p, const char * key, double def);
int cfg_get_bool(CFGMAP * p, const char * key, int def);
int cfg_isset_section(CFGMAP * p, const char * section);

#ifdef __cplusplus
}
#endif

#endif
